/*
Project: bai tap C-case-study nhom 4 C0707L (Dung, Phung, Giang)
Filename: xulyxau.c
Description: Cac ham lien quan den xu ly cac xau ki tu 
Author: Bui Kim Dung
Created Date: 26/10/2007
Modified Date:
*/
#include <D:\Bai tap C\c case study\global.c>
char left[40];
char right[40];
standard(char s[40])
{
     int i=0,j=0;
     while (i<= strlen(s))
     {
           if ((s[i]==' ')&&(s[i+1]==' '))
           {
               
               for (j=i;j<=strlen(s);j++)
                   s[j]= s[j+1];                        
           }  
           else 
           {
                i++;     
           }               
     }
     if (s[0]==' ') 
     {           
           for (j=0;j<=strlen(s);j++)
               s[j]= s[j+1];            
     } 
     if (s[strlen(s)-1]==' ') 
     {
           s[strlen(s)-1]=s[strlen(s)];
            
     }                           
}
leftword(char s[40])
{
     int i=0,j;
     strcpy(left,s);     
     while (s[i]!=' ') i++;
     for(j=i;j<=strlen(s);j++) left[j]='\0';
}
rightword(char s[40])
{
     int i,j,k=-1;
     i= strlen(s)-2;
     while (s[i]!=' ') i--; 
     for (j=i;j<=strlen(s);j++,k++) right[k]=s[j];             
}
/*main()
{
      char a[40];
      printf("\n\tNhap vao xau ki tu: ");
      fflush(stdin);
      gets(a);
      standard(a);
      printf("\n\tXau da chuan hoa: %s",a); 
      printf("\t\n%d",strlen(a)); 
      leftword(a);
      rightword(a);
      printf("\n\tHo la %s",left);
      printf("\n\tTen la %s",right);    
      getch();      
}
*/
